Invokes the specified function in a synchronized manner.
Syntax
'Declaration
<CanBeNullAttribute()>
Protected Overloads Function Synchronize(Of As Class)( _
ByVal As Func(Of TResult) _
) As
'Usage
Dim instance As NotifyingWidget
Dim function As Func(Of TResult)
Dim value As
value = instance.Synchronize(Of TResult)(function)
[CanBeNull()]
protected Synchronize<>(
Func<TResult>
)
where TResult: class
[CanBeNull()]
protected:
Synchronizegeneric<typename >
(
Func<TResult^>^
)
where TResult: ref class
Parameters
- function
- Function to be invoked.
Type Parameters
- TResult
- Type of the function result.
Return Value
Returns the result of invoking the specified function.
Exceptions
Exception | Description |
System.ArgumentNullException |
A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.
This is a usage error, i.e. it will never occur (the exception will not be thrown) in a correctly written program. Your code should not catch this exception. |
Requirements
Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows
See Also